import {createRouter, createWebHashHistory} from "vue-router";
import Index from '@/views/Index.vue'

const routes = [
	{
		path: '/',
		name: 'index',
		component: Index,
		children: [
			{
				path: '/',
				name: 'goods',
				component: () => import('@/views/goods/Index.vue')
			},
			{
				path: '/info/:id',
				name: 'info',
				component: () => import('@/views/goods/GoodsInfo.vue')
			},
			{
				path: '/cart',
				name: 'cart',
				component: () => import('@/views/Cart.vue')
			},
			{
				path: '/order',
				name: 'order',
				component: () => import('@/views/Order.vue')
			},
			{
				path: '/orderInfo',
				name: 'orderInfo',
				component: () => import('@/views/OrderInfo.vue')
			},
			{
				path: '/cashier',
				name: 'cashier',
				component: () => import('@/views/Cashier.vue')
			}
		]
	},
	{
		path: '/login',
		name: 'login',
		component: () => import('@/views/Login.vue')
	},
	{
		path: '/register',
		name: 'register',
		component: () => import('@/views/Register.vue')
	}
]

export default createRouter({
	history: createWebHashHistory(),
	routes
})